import request from '@/utils/request'

/**
 * 获取组织架构列表
 */
export function getDepartments() {
  return request({
    method: 'GET',
    url: '/company/department'
  })
}

/**
 * 通过部门id删除部门
 * @param {*} id 部门id
 */
export function delDeptById(id) {
  return request({
    method: 'DELETE',
    url: '/company/department/' + id
  })
}

/**
 * 添加部门
 * @param {*} data {}
 */
export function addDepartment(data) {
  return request({
    method: 'POST',
    url: '/company/department',
    data
  })
}

/**
 * 更新部门
 * @param {*} data {}
 */
export function updateDepartment(data) {
  return request({
    method: 'PUT',
    url: '/company/department/' + data.id,
    data
  })
}
